package com.hjl.header;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ServivE
 * @version 0.1
 * @className HeaderController
 * @description 接收请求头
 * @date 2024/8/12 20:31
 * @since jdk11
 */
@Controller
@ResponseBody
@RequestMapping("header")
public class HeaderController {
    @GetMapping("data")
    public String data(@RequestHeader("Host") String host) {
        System.out.println("host = " + host);
        return "host = " + host;
    }
}
